﻿using System;
using Assist;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using YArchitech.Revit.MEP.Calculator;
using HYView;

namespace YArchitech.Revit.MEP.Electric.Calculator.Command
{
	[Regeneration(RegenerationOption.Manual)]
	[Transaction(TransactionMode.Manual)]
	public class CmdIllCalculate : YJKCommandManual
	{
		protected override Result YJKExcute(ExternalCommandData cmdData, ref string message, ElementSet elements)
		{
			UIApplication application = cmdData.Application;
			Autodesk.Revit.DB.View activeView = application.ActiveUIDocument.Document.ActiveView;
			if ((int)activeView.ViewType != 1 && (int)activeView.ViewType != 2)
			{
				Result result = SwitchView.SetUsableView((CmdViewType)3, cmdData);
				if (result != Result.Succeeded)
				{
					return result;
				}
			}
			new SelectionTagUtility(application).ShowMainDlg();
			return Autodesk.Revit.UI.Result.Succeeded;
		}
	}
}
